﻿import request from "/@/utils/request";
enum Api {
	AddQuestionInfo = "/api/projectqa/BatchAdd",
	DeleteQuestionInfo = "/api/questionInfo/delete",
	BatchDeleteQuestionInfo = "/api/questionInfo/batchDelete",
	UpdateQuestionInfo = "/api/questionInfo/update",
	ImportQuestionInfo = "/api/questionInfo/import",
	DownLoadQuestionInfo = "/api/QuestionInfo/DownLoad",
	PageQuestionInfo = "/api/questionInfo/page",
	GetProjectByCode = "/api/questionInfo/GetQuestionInfo",
	GetProjectByCodeByProjectNo="/api/projectqa/GetProjectByCode",
	
}
// 导入
export const importQuestionInfo = (params?: any) => {
	const formData = new FormData();
	formData.append("file", params);
	// 请求配置
	const config = {
		headers: {},
	};
	request({
		url: Api.ImportQuestionInfo,
		method: "post",
		headers: { "Content-Type": "multipart/form-data" },
		data: formData,
		// data:formData
	});
};
// 增加问卷
export const addQuestionInfo = (params?: any) =>
	request({
		url: Api.AddQuestionInfo,
		method: "post",
		data: params,
	});

// 删除问卷
export const deleteQuestionInfo = (params?: any) =>
	request({
		url: Api.DeleteQuestionInfo,
		method: "post",
		data: params,
	});
// 批量删除问卷
export const batchDeleteQuestionInfo = (params?: any) =>
	request({
		url: Api.BatchDeleteQuestionInfo,
		method: "post",
		data: params,
	});

// 编辑问卷
export const updateQuestionInfo = (params?: any) =>
	request({
		url: Api.UpdateQuestionInfo,
		method: "post",
		data: params,
	});

export const PageQuestionInfo = (params?: any) =>
	request({
		url: Api.PageQuestionInfo,
		method: "post",
		data: params,
	});
// 分页查询问卷
export const GetProjectByCode = (params?: any) =>
	request({
		url: Api.GetProjectByCode,
		method: "post",
		data: params,
	});

	// 分页查询问卷-带ProjectNo
export const GetProjectByCodeByProjectNo = (params?: any) =>
	request({
		url: Api.GetProjectByCodeByProjectNo,
		method: "post",
		data: params,
	});

//下载问卷模板
export const downLoadQuestionInfo = (params?: any) =>
	request({
		url: Api.DownLoadQuestionInfo,
		method: "post",
		data: params,
		responseType: "blob",
	});
